package com.qiu.wbpostman.common;

import weibo4j.Weibo;
import weibo4j.http.AccessToken;

public class WeiBoTool {
	
	/**
	 * 根据accessToken或者用户密码得到weibo
	 * @param isOauth
	 * @param accessToken
	 * @param id
	 * @param password
	 * @return
	 */
	public static Weibo getWeibo(boolean isOauth,AccessToken accessToken,String id,String password){
		Weibo weibo = new Weibo();
		if(isOauth) {
			weibo.setToken(accessToken.getToken(), accessToken.getTokenSecret());
		}
		else {
			weibo.setUserId(id);
			weibo.setPassword(password);
		}
		return weibo;
	}
}
